package com.ylsd.prospectivestudent.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ylsd.prospectivestudent.entity.Clue;
import com.ylsd.prospectivestudent.mapper.ClueMapper;
import com.ylsd.prospectivestudent.service.ClueService;
import org.springframework.stereotype.Service;
import org.ylsdxy.model.response.CustomPage;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ClueServiceImpl implements ClueService {
    @Resource
    private ClueMapper clueMapper;
    @Override
    public List<Clue> findByPage(Integer id) {
//        PageHelper.startPage(clue.getPage(),clue.getSize());
//        List<Clue> list = clueMapper.findByPage(clue);
//        PageInfo<Clue> pageInfo = new PageInfo<>(list);
//
//        CustomPage<List<Clue>> customPage = CustomPage.<List<Clue>>builder()
//                .currentPage(clue.getPage())
//                .size(clue.getSize())
//                .totalPage(pageInfo.getPages())
//                .total(pageInfo.getTotal())
//                .data(list)
//                .build();
//        return customPage;
        return clueMapper.findByPage(id);
    }

    @Override
    public boolean insertClue(Clue clue) {
        return clueMapper.insertClue(clue);
    }

    @Override
    public boolean delClue(Integer id) {
        return clueMapper.delClue(id);
    }

    @Override
    public List<Clue> findByClue(Clue clue) {
        return clueMapper.findByClue(clue);
    }
}
